/*
 * createApplicantAccount.java
 *
 * Created on March 27, 2008, 4:20 AM
 */

import java.sql.*;
import javax.swing.*;
import java.util.Calendar;

/**
 *
 ** @author  Dustin Shiflett
 */
public class createApplicantAccount extends javax.swing.JDialog {
    dbAccess dbLink;
    
    // Convert password to string
    public static String convertPassword(char[] cPassword) {
            // Declare variables
            String strRet = new String("");

            // Go through each character
            for (int i = 0; i < cPassword.length; i++)
            {
                    strRet += cPassword[i];
            }
            return strRet;
    }
    
    private boolean checkPasswordInput() {
        char[] pass1, pass2;
        
        pass1 = passwordTxt.getPassword();
        pass2 = verifyPasswordTxt.getPassword();
        
        if ((pass1.length == pass2.length) && (pass1.length >= 4)) {
            for(int i = 0; i < pass1.length; i++) {
                if(pass1[i] != pass2[i]) {
                    return false;
                }
            }
        } else {
            JOptionPane.showMessageDialog(null, "Password fields do not match, or contain less than 4 characters.");
            return false;
        }
        return true; //NOTE: I feel like this is backwards; an error may be more likely to return true when it is false, but I'm at a loss for another way to do it.
    }
    
    private boolean verifyEmailSyntax() {
        String email = emailTxt.getText();
        int i = 0;
        
        i = email.indexOf('@');
        if (i > 0) {
            if(email.indexOf('.', i) > 0) {
                return true;
            } else {
                JOptionPane.showMessageDialog(null, "E-mail should be in the format 'a@b.com'.\n" +
                        "The e-mail that was attempted contained '@', but there was no '.' after it.");
            }
        } else {
            JOptionPane.showMessageDialog(null, "E-mail should be in the format 'a@b.com'.\n" +
                        "The e-mail that was attempted did not contain '@'.");
        }
        return false;
    }
    
    private String formatPhone() {
        return phoneTxt.getText().replace('-', ' ');
    }
    
    /** Creates new form createApplicantAccount */
    public createApplicantAccount(java.awt.Frame parent, boolean modal) {
        super(parent, modal);
        initComponents();
    }
    
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        jLabel8 = new javax.swing.JLabel();
        jLabel9 = new javax.swing.JLabel();
        jLabel10 = new javax.swing.JLabel();
        jLabel11 = new javax.swing.JLabel();
        jLabel7 = new javax.swing.JLabel();
        jLabel12 = new javax.swing.JLabel();
        jLabel13 = new javax.swing.JLabel();
        submitBtn = new javax.swing.JButton();
        nameTxt = new javax.swing.JTextField();
        emailTxt = new javax.swing.JTextField();
        jLabel14 = new javax.swing.JLabel();
        degreeSelect = new javax.swing.JComboBox();
        citizenshipSelect = new javax.swing.JComboBox();
        jScrollPane1 = new javax.swing.JScrollPane();
        descriptionTxt = new javax.swing.JTextArea();
        passwordTxt = new javax.swing.JPasswordField();
        verifyPasswordTxt = new javax.swing.JPasswordField();
        javax.swing.text.MaskFormatter fmt = null;
        // A phone number
        try {
            fmt = new javax.swing.text.MaskFormatter("###-###-####");
        } catch (java.text.ParseException e) {
        }
        phoneTxt = new javax.swing.JFormattedTextField(fmt);
        yearsExperience = new javax.swing.JSpinner();
        birthYear = new javax.swing.JSpinner();
        jLabel15 = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);

        jLabel1.setFont(new java.awt.Font("Times New Roman", 1, 14));
        jLabel1.setText("Create an Applicant Account");

        jLabel2.setFont(new java.awt.Font("Times New Roman", 0, 12));
        jLabel2.setText("Highest degree");

        jLabel3.setFont(new java.awt.Font("Times New Roman", 0, 12));
        jLabel3.setText("Birth year (4-digit)");

        jLabel4.setFont(new java.awt.Font("Times New Roman", 0, 12));
        jLabel4.setText("Years of experience");

        jLabel5.setFont(new java.awt.Font("Times New Roman", 0, 12));
        jLabel5.setText("Citizenship");

        jLabel6.setFont(new java.awt.Font("Times New Roman", 0, 12));
        jLabel6.setText("Phone (US Only-10 digit)");

        jLabel8.setFont(new java.awt.Font("Times New Roman", 0, 12));
        jLabel8.setText("*Re-enter password:");

        jLabel9.setFont(new java.awt.Font("Times New Roman", 0, 12));
        jLabel9.setText("*Email:");

        jLabel10.setFont(new java.awt.Font("Times New Roman", 0, 12));
        jLabel10.setText("*Choose a Password:");

        jLabel11.setFont(new java.awt.Font("Times New Roman", 0, 12));
        jLabel11.setText("*Name:");

        jLabel7.setFont(new java.awt.Font("Times New Roman", 1, 14));
        jLabel7.setText("Your Profile ( You can update it later)");

        jLabel12.setFont(new java.awt.Font("Times New Roman", 0, 12));
        jLabel12.setText("Short Description");

        jLabel13.setFont(new java.awt.Font("Times New Roman", 0, 12));
        jLabel13.setText("(Not exceed 500 characters)");

        submitBtn.setFont(new java.awt.Font("Times New Roman", 0, 12));
        submitBtn.setText("Submit");
        submitBtn.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                submitBtnActionPerformed(evt);
            }
        });

        jLabel14.setFont(new java.awt.Font("Times New Roman", 0, 12));
        jLabel14.setText("*required");

        degreeSelect.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Not Selected", "PhD", "Specialist", "Master", "Bachelor", "High School or below" }));

        citizenshipSelect.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Not Selected", "US", "Canadian", "Mexican", "Other" }));

        descriptionTxt.setColumns(20);
        descriptionTxt.setLineWrap(true);
        descriptionTxt.setRows(5);
        descriptionTxt.setWrapStyleWord(true);
        jScrollPane1.setViewportView(descriptionTxt);
        descriptionTxt.setDocument(new JTextFieldLimit(500));

        passwordTxt.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                passwordTxtActionPerformed(evt);
            }
        });
        passwordTxt.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                passwordTxtKeyPressed(evt);
            }
            public void keyTyped(java.awt.event.KeyEvent evt) {
                passwordTxtKeyTyped(evt);
            }
        });

        verifyPasswordTxt.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                verifyPasswordTxtActionPerformed(evt);
            }
        });
        verifyPasswordTxt.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                verifyPasswordTxtKeyPressed(evt);
            }
            public void keyTyped(java.awt.event.KeyEvent evt) {
                verifyPasswordTxtKeyTyped(evt);
            }
        });

        phoneTxt.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                phoneTxtActionPerformed(evt);
            }
        });

        SpinnerModel expModel = new SpinnerNumberModel(0, //initial value
            0, //min
            100, //max
            1); //step
        yearsExperience.setModel(expModel);
        yearsExperience.setEditor(new JSpinner.NumberEditor(yearsExperience, "#")); //Let the field only accept numeric input

        //Set possible values
        Calendar calendar = Calendar.getInstance();
        int currentYear = calendar.get(Calendar.YEAR);
        SpinnerModel yearModel = new SpinnerNumberModel(currentYear - 25, //initial value (25-year old)
            currentYear - 110, //min (110 years before today)
            currentYear, //max (this year, though no 0 year old will apply)
            1);                //step
        birthYear.setModel(yearModel);
        birthYear.setEditor(new JSpinner.NumberEditor(birthYear, "#")); //Let the field only accept numeric input

        jLabel15.setFont(new java.awt.Font("Tahoma", 0, 10));
        jLabel15.setText("(4 character minimum)");

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(10, 10, 10)
                .addComponent(jLabel7, javax.swing.GroupLayout.PREFERRED_SIZE, 245, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(240, Short.MAX_VALUE))
            .addGroup(layout.createSequentialGroup()
                .addGap(10, 10, 10)
                .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 185, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(300, Short.MAX_VALUE))
            .addGroup(layout.createSequentialGroup()
                .addGap(208, 208, 208)
                .addComponent(submitBtn)
                .addContainerGap(220, Short.MAX_VALUE))
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 113, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 113, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 113, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(layout.createSequentialGroup()
                        .addContainerGap()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel12, javax.swing.GroupLayout.PREFERRED_SIZE, 113, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel13, javax.swing.GroupLayout.PREFERRED_SIZE, 146, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(10, 10, 10)
                        .addComponent(jLabel8, javax.swing.GroupLayout.PREFERRED_SIZE, 113, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(10, 10, 10)
                        .addComponent(jLabel11, javax.swing.GroupLayout.PREFERRED_SIZE, 113, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 113, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jLabel6))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(10, 10, 10)
                        .addComponent(jLabel9, javax.swing.GroupLayout.DEFAULT_SIZE, 146, Short.MAX_VALUE))
                    .addGroup(layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jLabel10, javax.swing.GroupLayout.DEFAULT_SIZE, 146, Short.MAX_VALUE)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 206, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addContainerGap())
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                    .addComponent(citizenshipSelect, javax.swing.GroupLayout.Alignment.LEADING, 0, 213, Short.MAX_VALUE)
                                    .addComponent(degreeSelect, 0, 213, Short.MAX_VALUE))
                                .addGap(122, 122, 122))
                            .addGroup(layout.createSequentialGroup()
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(layout.createSequentialGroup()
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 52, Short.MAX_VALUE)
                                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                            .addComponent(emailTxt, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 159, Short.MAX_VALUE)
                                            .addComponent(nameTxt, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 159, Short.MAX_VALUE)
                                            .addComponent(passwordTxt)
                                            .addComponent(verifyPasswordTxt)))
                                    .addGroup(layout.createSequentialGroup()
                                        .addComponent(phoneTxt, javax.swing.GroupLayout.PREFERRED_SIZE, 135, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addGap(65, 65, 65)))
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(layout.createSequentialGroup()
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 19, Short.MAX_VALUE)
                                        .addComponent(jLabel14, javax.swing.GroupLayout.PREFERRED_SIZE, 95, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addContainerGap())
                                    .addGroup(layout.createSequentialGroup()
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(jLabel15)
                                        .addGap(17, 17, 17)))))
                        .addGroup(layout.createSequentialGroup()
                            .addComponent(yearsExperience, javax.swing.GroupLayout.PREFERRED_SIZE, 47, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addContainerGap()))
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(birthYear, javax.swing.GroupLayout.PREFERRED_SIZE, 59, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addContainerGap())))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(27, 27, 27)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel11, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(nameTxt, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel9, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(emailTxt, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel14, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(passwordTxt, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel10, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel15))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel8, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(verifyPasswordTxt, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(11, 11, 11)
                .addComponent(jLabel7, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(phoneTxt, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(14, 14, 14)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(degreeSelect, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(birthYear, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(yearsExperience, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(citizenshipSelect, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(18, 18, 18)
                        .addComponent(jLabel12, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel13, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(10, 10, 10)
                        .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 67, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addGap(27, 27, 27)
                .addComponent(submitBtn)
                .addGap(20, 20, 20))
        );

        nameTxt.setDocument(new JTextFieldLimit(50));
        emailTxt.setDocument(new JTextFieldLimit(50));
        passwordTxt.setDocument(new JTextFieldLimit(8));
        verifyPasswordTxt.setDocument(new JTextFieldLimit(8));

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void submitBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_submitBtnActionPerformed
        // TODO add your handling code here:
        boolean success = false;
        //Check to make sure name contains text, password fields match, and e-mail syntax is correct
        if(!(nameTxt.getText().equals("")) && checkPasswordInput() && verifyEmailSyntax()) {
            //Since syntax is correct, we need to form our DB INSERT statement
            
            try {
                dbLink = new dbAccess();
                dbLink.connect();
                success = dbLink.createNewApplicant(nameTxt.getText(), Integer.parseInt(birthYear.getValue().toString()),
                        emailTxt.getText(), convertPassword(passwordTxt.getPassword()), formatPhone(), 
                        Integer.parseInt(yearsExperience.getValue().toString()), degreeSelect.getSelectedItem().toString(), 
                        citizenshipSelect.getSelectedItem().toString(), descriptionTxt.getText());
            } catch (SQLException se) {
                JOptionPane.showMessageDialog(null, "SQLException thrown while trying to insert.\n" +
                    "Error: " + se.getMessage());
                System.exit(-1);
            }
            if(success) {
                //Row inserted: close window and go to Applicant Main Page
                applicantMainPage dialog = new applicantMainPage(); //Pass the applicant's e-mail so we know who is logged in 
                //new javax.swing.JFrame(), true not used here, why does applicantMainPage have a different constructor method?
                //I think it has something to do with the tabs or tables, What else could it be?
                dialog.addWindowListener(new java.awt.event.WindowAdapter() {
                    public void windowClosing(java.awt.event.WindowEvent e) {
                        System.exit(0);
                    }
                });
                dialog.setDB(dbLink);
                dispose();
                dialog.setVisible(true);
            }
        } else {
            if (nameTxt.getText().equals(""))
                JOptionPane.showMessageDialog(null, "A value must be entered in the name field.");
        }
}//GEN-LAST:event_submitBtnActionPerformed

    private void passwordTxtActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_passwordTxtActionPerformed
        // TODO add your handling code here:
}//GEN-LAST:event_passwordTxtActionPerformed

    private void phoneTxtActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_phoneTxtActionPerformed
        // TODO add your handling code here:
}//GEN-LAST:event_phoneTxtActionPerformed

    private void verifyPasswordTxtActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_verifyPasswordTxtActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_verifyPasswordTxtActionPerformed

    private void passwordTxtKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_passwordTxtKeyTyped
        // TODO add your handling code here:
    }//GEN-LAST:event_passwordTxtKeyTyped

    private void verifyPasswordTxtKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_verifyPasswordTxtKeyTyped
        // TODO add your handling code here:
    }//GEN-LAST:event_verifyPasswordTxtKeyTyped

    private void passwordTxtKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_passwordTxtKeyPressed
        // TODO add your handling code here:
    }//GEN-LAST:event_passwordTxtKeyPressed

    private void verifyPasswordTxtKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_verifyPasswordTxtKeyPressed
        // TODO add your handling code here:
    }//GEN-LAST:event_verifyPasswordTxtKeyPressed
    
    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                createApplicantAccount dialog = new createApplicantAccount(new javax.swing.JFrame(), true);
                dialog.addWindowListener(new java.awt.event.WindowAdapter() {
                    public void windowClosing(java.awt.event.WindowEvent e) {
                        System.exit(0);
                    }
                });
                dialog.setVisible(true);
            }
        });
    }
    
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JSpinner birthYear;
    private javax.swing.JComboBox citizenshipSelect;
    private javax.swing.JComboBox degreeSelect;
    private javax.swing.JTextArea descriptionTxt;
    private javax.swing.JTextField emailTxt;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JTextField nameTxt;
    private javax.swing.JPasswordField passwordTxt;
    private javax.swing.JFormattedTextField phoneTxt;
    private javax.swing.JButton submitBtn;
    private javax.swing.JPasswordField verifyPasswordTxt;
    private javax.swing.JSpinner yearsExperience;
    // End of variables declaration//GEN-END:variables
    
}
